/*
Version 1.0

Suparerk@

*/

(function($) {
		  
	jQuery.fn.KeyCode = function(settings) {
		
		var defaults = {
			Val: "number", //number, charactor
			returnTo:null
		}
		
		var options = jQuery.extend(defaults, settings);
		
		$(this).keydown(function(e){
			var e_k = e.keyCode
			if(options.Val =="number"){
				if (( (e_k != 13) && (e_k != 8) ) && (e_k < 48) || (e_k > 57) && (e_k < 96) || (e_k > 105) ) { 
					if(options.returnTo != null){setTimeout(options.returnTo,0)}//call back function
					e.returnValue = false; return false;
				}
			}else{
				if(( (e_k != 13) && (e_k != 8) ) && (e_k < 65) || (e_k > 90) ){
					if(options.returnTo != null){setTimeout(options.returnTo,0)}//call back function
					e.returnValue = false; return false;
				}
			}
	
		});
		
	
	};	
})(jQuery);
